﻿


''' <summary>
''' GoogleDesktop Exception 
''' </summary>
''' <remarks></remarks>
<Serializable()> _
Public MustInherit Class GoogleDesktopException
    Inherits Exception


    Sub New(ByVal message As String, ByVal code As Integer, ByVal inEx As Exception)

        MyBase.New(message, inEx)

        Me.HResult = code

    End Sub




    Public ReadOnly Property Code() As Integer
        Get
            Return Me.HResult
        End Get
    End Property

End Class


'''<summary>returned when the application that made the call is exiting</summary>
'''<remarks>E_APPLICATION_IS_EXITING</remarks>
Public Class ApplicationIsExitingException
    Inherits GoogleDesktopException
    Public Sub New()
        MyClass.New(Nothing)
    End Sub
    Sub New(ByVal inEx As Exception)
        MyBase.New(My.Resources.GoogleDesktopException.ApplicationIsExiting, E_APPLICATION_IS_EXITING, inEx)
    End Sub
End Class



#Region "Component"


'''<summary> 
''' specifies that the component is already registered
''' </summary> 
''' <remarks > E_COMPONENT_ALREADY_REGISTERED </remarks>
Public Class ComponentAlreadyRegisteredException
    Inherits GoogleDesktopException
    Public Sub New()
        MyClass.New(Nothing)
    End Sub
    Sub New(ByVal inEx As Exception)
        MyBase.New(My.Resources.GoogleDesktopException.ComponentAlreadyRegistered, E_COMPONENT_ALREADY_REGISTERED, inEx)

    End Sub
End Class



'''<summary>
''' specifies that the component has been disabled by the user
''' </summary>
''' <remarks> E_COMPONENT_DISABLED </remarks>
Public Class ComponentDisabledException
    Inherits GoogleDesktopException

    Public Sub New()
        MyClass.New(Nothing)
    End Sub
    Sub New(ByVal inEx As Exception)
        MyBase.New(My.Resources.GoogleDesktopException.ComponentDisabled, E_COMPONENT_DISABLED, inEx)
    End Sub
End Class


''' <summary>
''' specifies that the component must register before performing any operations 
''' </summary>
''' <remarks> E_COMPONENT_NOT_REGISTERED</remarks>
Public Class ComponentNotRegisteredException
    Inherits GoogleDesktopException

    Public Sub New()
        MyClass.New(Nothing)
    End Sub
    Sub New(ByVal inEx As Exception)
        MyBase.New(My.Resources.GoogleDesktopException.ComponentNotRegistered, E_COMPONENT_NOT_REGISTERED, inEx)

    End Sub

End Class


'''<summary>specifies that the component is prohibited by the user's group policy</summary>
'''<remarks>E_COMPONENT_PROHIBITED</remarks>
Public Class ComponentProhibitedExpction
    Inherits GoogleDesktopException
    Public Sub New()
        MyClass.New(Nothing)
    End Sub
    Sub New(ByVal inEx As Exception)
        MyBase.New(My.Resources.GoogleDesktopException.ComponentProhibited, E_COMPONENT_PROHIBITED, inEx)
    End Sub
End Class


#End Region



'''<summary>specifies that the event was rejected because of data size limits</summary>
''' <remarks>E_EVENT_TOO_LARGE</remarks>
Public Class EventTooLargeException
    Inherits GoogleDesktopException
    Public Sub New()
        MyClass.New(Nothing)
    End Sub
    Sub New(ByVal inEx As Exception)
        MyBase.New(My.Resources.GoogleDesktopException.EventTooLarge, E_EVENT_TOO_LARGE, inEx)

    End Sub
End Class



''' <summary>
''' the handled extension is REGISTERED 
''' </summary>
''' <remarks> same E_EXTENSION_REGISTERED</remarks>
Public Class ExtensionRegisteredException
    Inherits GoogleDesktopException

    Public Sub New()
        MyClass.New(Nothing)
    End Sub
    Sub New(ByVal inEx As Exception)
        MyBase.New(My.Resources.GoogleDesktopException.ExtensionRegistered, E_EXTENSION_REGISTERED, inEx)
    End Sub

End Class




'''<summary>specifies that an event has invalid flags</summary>
''' <remarks>E_INVALID_EVENT_FLAGS</remarks>
Public Class InvalidEventFlagsException
    Inherits GoogleDesktopException

    Public Sub New()
        MyClass.New(Nothing)
    End Sub
    Sub New(ByVal inEx As Exception)
        MyBase.New(My.Resources.GoogleDesktopException.InvalidEventFlags, E_INVALID_EVENT_FLAGS, inEx)

    End Sub
End Class




#Region "No such"


'''<summary>
''' returned when a component tries to use an inexistent schema
'''</summary>
''' <remarks> E_NO_SUCH_SCHEMA </remarks>
Public Class NoSuchSchemaException
    Inherits GoogleDesktopException

    Public Sub New()
        MyClass.New(Nothing)
    End Sub
    Sub New(ByVal inEx As Exception)
        MyBase.New(My.Resources.GoogleDesktopException.NoSuchSchema, E_NO_SUCH_SCHEMA, inEx)

    End Sub

End Class


'''<summary>
''' returned when a component tries to use an inexistent property
''' </summary>
''' <remarks> E_NO_SUCH_PROPERTY </remarks>
Public Class NoSuchPropertyException
    Inherits GoogleDesktopException

    Public Sub New()
        MyClass.New(Nothing)
    End Sub
    Sub New(ByVal inEx As Exception)
        MyBase.New(My.Resources.GoogleDesktopException.NoSuchProperty, E_NO_SUCH_PROPERTY, inEx)

    End Sub
End Class

#End Region

#Region "Property"

'''<summary>returned when a property is not set</summary>
'''<remarks>E_PROPERTY_NOT_SET</remarks>
Public Class PropertyNotSetException
    Inherits GoogleDesktopException
    Public Sub New()
        MyClass.New(Nothing)
    End Sub
    Sub New(ByVal inEx As Exception)
        MyBase.New(My.Resources.GoogleDesktopException.PropertyNotSet, E_PROPERTY_NOT_SET, inEx)
    End Sub
End Class

'''<summary>specifies that the provided property is too large and cannot be accepted</summary>
''' <remarks>E_PROPERTY_TOO_LARGE</remarks>
Public Class PropertyTooLargeException
    Inherits GoogleDesktopException
    Public Sub New()
        MyClass.New(Nothing)
    End Sub
    Sub New(ByVal inEx As Exception)
        MyBase.New(My.Resources.GoogleDesktopException.PropertyTooLarge, E_PROPERTY_TOO_LARGE, inEx)
    End Sub
End Class


#End Region



'''<summary> specifies that the gadget registration was cancelled by the user</summary>
''' <remarks>E_REGISTRATION_CANCELLED_BY_USER</remarks>
Public Class RegistrationCancelledByUserException
    Inherits GoogleDesktopException
    Public Sub New()
        MyClass.New(Nothing)
    End Sub
    Sub New(ByVal inEx As Exception)
        MyBase.New(My.Resources.GoogleDesktopException.RegistrationCancelledByUser, E_REGISTRATION_CANCELLED_BY_USER, inEx)
    End Sub
End Class



'''<summary> specifies that the event could not be delivered and a re-send is required</summary>
''' <remarks>E_RETRY_SEND</remarks>
Public Class RetrySendExcpetion
    Inherits GoogleDesktopException
    Public Sub New()
        MyClass.New(Nothing)
    End Sub
    Sub New(ByVal inEx As Exception)
        MyBase.New(My.Resources.GoogleDesktopException.RetrySend, E_RETRY_SEND, inEx)
    End Sub
End Class



'''<summary>specifies that the search has been locked by the user</summary>
''' <remarks>E_SEARCH_LOCKED</remarks>
Public Class SearchLockedException
    Inherits GoogleDesktopException
    Public Sub New()
        MyClass.New(Nothing)
    End Sub
    Sub New(ByVal inEx As Exception)
        MyBase.New(My.Resources.GoogleDesktopException.SearchLocked, E_SEARCH_LOCKED, inEx)
    End Sub
End Class

#Region "Send"

'''<summary>specifies that the historical event sent could not be delivered immediately and a delay is recommended before sending again</summary>
''' <remarks>E_SEND_DELAYED</remarks>
Public Class SendDelayedException
    Inherits GoogleDesktopException
    Public Sub New()
        MyClass.New(Nothing)
    End Sub
    Sub New(ByVal inEx As Exception)
        MyBase.New(My.Resources.GoogleDesktopException.SendDelayed, E_SEND_DELAYED, inEx)

    End Sub
End Class

'''<summary>
''' specifies that the event could not be delivered because required resources were not available and the send operation timed out
''' </summary> 
''' <remarks>E_SEND_TIMEOUT</remarks>
Public Class SendTimeoutException
    Inherits GoogleDesktopException
    Public Sub New()
        MyClass.New(Nothing)
    End Sub
    Sub New(ByVal inEx As Exception)
        MyBase.New(My.Resources.GoogleDesktopException.SendTimeout, E_SEND_TIMEOUT, inEx)

    End Sub
End Class

#End Region

#Region "Service"
'''<summary>returned when the Google Destop system is exiting.</summary>
''' <remarks>E_SERVICE_IS_EXITING</remarks>
Public Class ServiceIsExitingException
    Inherits GoogleDesktopException
    Public Sub New()
        MyClass.New(Nothing)
    End Sub
    Sub New(ByVal inEx As Exception)
        MyBase.New(My.Resources.GoogleDesktopException.ServiceIsExiting, E_SERVICE_IS_EXITING, inEx)
    End Sub
End Class


''' <summary>
''' specifies that Google Desktop is not running
''' </summary>
''' <remarks>E_SERVICE_NOT_RUNNING </remarks>
Public Class ServiceNotRunningException
    Inherits GoogleDesktopException

    Public Sub New()
        MyClass.New(Nothing)
    End Sub
    Sub New(ByVal inEx As Exception)
        MyBase.New(My.Resources.GoogleDesktopException.ServiceNotRunning, E_SERVICE_NOT_RUNNING, inEx)

    End Sub
End Class

#End Region




''''<summary>
'''' specifies that indexing is paused and any sent events will be ignored
'''' </summary>
'Public Const S_INDEXING_PAUSED As Integer = &H80040007
Public Class IndexingPausedException
    Inherits GoogleDesktopException
    Public Sub New()
        MyClass.New(Nothing)
    End Sub
    Sub New(ByVal inEx As Exception)
        MyBase.New(My.Resources.GoogleDesktopException.IndexingPaused, S_INDEXING_PAUSED, inEx)
    End Sub
End Class




'''<summary>specifies that the provided property has been truncated due to size limits</summary>
''' <remarks>S_PROPERTY_TRUNCATED</remarks>
Public Class PropertyTruncatedException
    Inherits GoogleDesktopException
    Public Sub New()
        MyClass.New(Nothing)
    End Sub
    Sub New(ByVal inEx As Exception)
        MyBase.New(My.Resources.GoogleDesktopException.PropertyTruncated, S_PROPERTY_TRUNCATED, inEx)
    End Sub
End Class


